import { KG_SCENE_PREFIX } from "@/utils/scene";
import { SESSION_TYPE } from "@/utils/chat";
import store from "store2";

interface IReqAdapter {
  req: any;
  type?: "getRecommended" | "conversation";
}
export const reqAdapter = (props: IReqAdapter) => {
  let chatScene = store.get("supcon.bs.chatScene") || "";
  const { req = {}, type = "conversation" } = props;
  let cReq = {
    ...req,
    sessionType: chatScene || SESSION_TYPE.text_chat,
  };

  if (type === "conversation") {
    // if (chatScene && chatScene.includes(KG_SCENE_PREFIX)) {
    //   // 知识库 对话参数注入
    //   cReq = knowledgeBaseReqAdapter(cReq);
    // } else if (chatScene === dataAnalysis) {
    //   // 数据集 对话参数注入
    //   cReq = chatBIBaseReq(cReq);
    // } else if (chatScene === offlineData) {
    //   // 离线数据 对话参数注入
    //   cReq = chatOfflineDataReq(cReq);
    // } else if (chatScene === chatTPT) {
    //   // chatTPT 对话参数注入
    //   cReq = chatTPTBaseReq(cReq);
    // }
  } else if (type === "getRecommended") {
    if (!chatScene || chatScene === "default") {
      cReq = {
        ...cReq,
        scene: {
          id: "",
          name: "",
          type: "",
        },
      };
    } else if (chatScene && chatScene.includes(KG_SCENE_PREFIX)) {
      //   // 知识库  推荐问题参数注入
      //   cReq = knowledgeBaseReqAdapter(cReq);
      // } else if (chatScene === dataAnalysis) {
      //   // 数据集 推荐问题参数注入
      //   cReq = chatBIBaseReq(cReq);
      // } else if (chatScene === chatTPT) {
      //   // chatTPT 推荐问题参数注入
      //   cReq = chatTPTBaseReq(cReq);
    } else {
      cReq = {
        ...cReq,
        scene: {
          id: "",
          name: "",
          type: "",
        },
      };
    }
  }

  return cReq;
};
